{% extends 'layout.html' %}
{% load static %}
{% block content %}

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{{ title }}</h3>
        </div>
        <div class="panel-body">

            <form action="" method="post" class="form-horizontal" novalidate enctype="multipart/form-data">
                {% csrf_token %}
                {% for field in form_obj %}
                    {% if field.name != 'detail' %}
                        <div class="form-group {% if field.errors %}has-error{% endif %}">
                            <label {% if not field.field.required %}style="color:#8c8c8c;"{% endif %}
                                   for="{{ field.id_for_label }}"
                                   class="col-sm-2 control-label">{{ field.label }}</label>
                            <div class="col-sm-8">
                                {{ field }}

                                <span class="help-block">{{ field.errors.0 }}</span>
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
                <!--文章详情-->
                {% for field in detail_from %}

                    <div class="form-group {% if field.errors %}has-error{% endif %}">
{#                        <label {% if not field.field.required %}style="color:#8c8c8c;"{% endif %}#}
{#                               for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>#}
                        <div class="col-lg-offset-2 col-sm-8">
                            {{ field }}

                            <span class="help-block">{{ field.errors.0 }}</span>
                        </div>
                    </div>
                {% endfor %}

                <div class="text-danger text-center">{{ form_obj.non_field_errors.0 }}</div>


                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary">提交</button>
                    </div>
                </div>
            </form>

        </div>

    </div>



{% endblock %}

{% block js %}
    <script type="text/javascript" src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
    <script type="text/javascript" src="{% static 'ckeditor/ckeditor-init.js' %}"></script>
{% endblock %}